package com.fuyao.cloud.auth.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;

@Data
@Component
@RefreshScope
@ConfigurationProperties(prefix = "sso-login")
public class SsoLoginConfig {

    /**
     * 密钥
     */
    private String secret;

    /**
     * 授权码存活时间
     */
    private Long codeLiveTimeMillis;

    /**
     * 授权码默认存活时间 2 分钟
     */
    public static Long defaultCodeLiveTimeMillis = 2 * 60 * 1000L;

    public Long getCodeLiveTimeMillis() {
        return this.codeLiveTimeMillis == null ? defaultCodeLiveTimeMillis : this.codeLiveTimeMillis;
    }
}
